<?= isset($header) ? $header : '' ?>
<div id="content">
    <div style="overflow:visible;" class="form_style">
        <div class="title">
            <h5>需求查詢</h5>
        </div>
        <form method="post" action="<?= site_url('/demand/the_data_query_results') ?>" id="userinfo">

            <input type="hidden"   name="type" value="<?=!empty($type)?$type:''?>">
            <table>
                <tbody><tr>
                        <th>客戶姓名</th>
                        <td>
                            <input type="text" info="姓名" class="check" id="name" name="name">
                        </td>
                        <th>需求等級</th>
                        <td>
                            <select id="required_level"  name="required_level" class="full_select">
                                <option value="">&nbsp;</option>
                                <?
                                foreach($required_level as $key=>$val){
                                ?>
                                <option value="<?= $val->required_level_id ?>"><?= $val->value ?></option>
                                <?
                                }
                                ?>
                            </select>
                        </td>
                        <th>需求類型</th>
                        <td>
                            <input type="checkbox"  value="1" id="type_sell" name="type_sell" >買賣
                            <input type="checkbox"  value="1" id="type_rent" name="type_rent" >租賃

                            <!--
                            <input type="checkbox" value="1" id="type_consignment" name="type_consignment">代銷
                            -->

                        </td>
                        <th>物件用途</th>
                        <td>
                            <select name="object_usage" id="object_usage" class="full_select">
                                <option value="">&nbsp;</option>
                                <? foreach($object_usage as $key=>$val){
                                ?>
                                <option value="<?= $val->object_usage_id ?>"><?= $val->value ?></option>
                                <?
                                }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>建物面積</th>
                        <td colspan="3">
                            <input type="text" name="building_area1" id="building_area1"> ~ <input type="text" name="building_area2" id="building_area2">坪
                        </td>
                        <th>室內面積</th>
                        <td colspan="3">
                            <input type="text" name="indoor_area1" id="indoor_area1"> ~ <input type="text" name="indoor_area2" id="indoor_area2">坪
                        </td>
                    </tr>
                    <tr>
                        <th>土地面積</th>
                        <td colspan="3">
                            <input type="text" name="land_area1" id="land_area1"> ~ <input type="text" name="land_area2" id="land_area2">坪
                        </td>
                        <th>總預算</th>
                        <td colspan="3">
                            <input type="text" class="post" name="total_budget1" id="total_budget1"> ~ <input type="text" class="post" name="total_budget2" id="total_budget2">萬
                        </td>
                    </tr>
                    <tr>
                        <th>重點區域</th>
                        <td><input type="text"  name="key_areas" id="key_areas" onclick="show_emphasis_area('key_areas')">
                        </td>
                        <th>指定大樓</th>
                        <td>
                            <input type="text"  name="specify_building" id="specify_building" onclick="show_building_name('specify_building')">
                        </td>

                        <th>物件案名</th>
                        <td colspan="3">
                            <input type="text" name="object_name" id="object_name" onclick="show_object_case_name('object_name');">
                        </td>
                    </tr>

                    <tr class="color">
                        <th>
                <div id="icon-plus">
                    <a onclick="query_more();" class="additem">
                        <i style="color:#25EA41" class="icon-plus" id="query_more_icon">&nbsp;&nbsp;
                        </i>
                    </a>&nbsp;
                    路段
                </div>
                </th>
                <td colspan="7">
                    <input type="text" style="width:260px;"  name="sections1" id="sections1" onclick="show_address('sections1');">~<input type="text" style="width:260px;"  name="sections2" id="sections2" onclick="show_address('sections2');">
                </td>
                </tr>
                </tbody>
                <tbody style="display:;" id="query_more">
                    <tr class="color">
                        <th>行政區</th>
                        <td>
                            <input type="text" name="administrative_area" id="administrative_area" onclick="show_administrative_area('administrative_area');">
                        </td>
                        <th>屋齡</th>
                        <td><input type="text"  name="year_of_construction1" id="year_of_construction1" style="width:36px;">~<input type="text"  name="year_of_construction2" id="year_of_construction2" style="width:36px;">年</td>
                        <th>物件案別</th>
                        <td>
                            <input type="checkbox" value="1" name="object_case_type[]" class="post">中古屋
                            <input type="checkbox" value="2" name="object_case_type[]">預售
                            <input type="checkbox" value="3" name="object_case_type[]">標售
                        </td>
                        <th>狀態</th>
                        <td>
                            <select name="status" id="status" class="full_select">
                                <option value="">&nbsp;</option>
                                <option value="Y">有效</option>
                                <option value="N">無效</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>客戶來源</th>
                        <td>
                            <select name="customer_source" id="customer_source" class="full_select">
                                <option value="">&nbsp;</option>
                                <?
                                foreach($customer_source as $key=>$val){
                                ?>
                                <option value="<?= $val->customer_source_id ?>"><?= $val->value ?></option>
                                <?
                                }
                                ?>
                            </select>
                        </td>
                        <th>建檔日期</th>
                        <td>
                            <input type="text" class="Wdate" style="width:92px;" onclick="WdatePicker()" name="sctime" id="sctime">~<input type="text" class="Wdate" style="width:92px;" onclick="WdatePicker()" name="ectime" id="ectime">
                        </td>
                        <th>關鍵字</th>
                        <td><input type="text" name="keywords" id="keywords"></td>
                        <th>經紀人</th>
                        <td>
                            <select type="text" name="broker" id="broker">
                                <option></option>
                            <?php
                            foreach($all_users as $user ){
                                echo '<option value="'.$user->users_id.'">';
                                echo $user->name;
                                echo '</option>';
                            }
                            ?>
                            </selctl>

                        </td>
                    </tr>
                </tbody>
                <tfoot>
                    <tr>
                        <td>&nbsp;</td>
                        <td colspan="7">
                            <input type="submit" value="查詢確認" class="input_background">

                        </td>
                    </tr>
                </tfoot></table></form>
    </div>

    <div id="address_select" style="display: none;">
        <div id="city_div"  style="float:left;padding:10px">
            <h3>縣市</h3>
            <select onchange="city_choose();" size="20" id="city">
                <option value="">請選擇</option>
                <?
                foreach($address_city as $key=>$val){
                ?>
                <option value="<?= $val->id ?>"><?= $val->name ?></option>
                <?
                }
                ?>
            </select>
        </div>
        <div id="area_div"  style="float:left;padding:10px">
            <h3>區域</h3>
            <select onchange="county_choose();" size="20" id="country">
                <option value="">請選擇</option>
                <?
                foreach($address_county as $key=>$val){
                ?>
                <option value="<?= $val->id ?>" ><?= $val->name ?></option>
                <?
                }
                ?>
            </select>
        </div>
        <div id="street_div" style="float:left;padding:10px">
            <h3>街道</h3>
            <select onchange="street_choose()" size="20" id="street">
                <option value="">請選擇</option>
            </select>
        </div>
        <div id="other_div" style="float:left;padding:10px">
            <h3>其它</h3>
            <div>
                <input type="button" onclick="word_choose('thousand')" value="千" class="button" name="thousand" id="thousand">
                <input type="button" onclick="word_choose('village')" value="村" class="button" name="village" id="village">
                <input type="button" onclick="word_choose('in')" value="里" class="button" name="in" id="in">
                <input type="button" onclick="word_choose('neighbor')" value="鄰" class="button" name="neighbor" id="neighbor">
            </div>
            <div>
                <input type="button" onclick="word_choose('road')" value="路" class="button" name="road" id="road">
                <input type="button" onclick="word_choose('word_street')" value="街" class="button" name="word_street" id="word_street">
                <input type="button" onclick="word_choose('paragraph')" value="段" class="button" name="paragraph" id="paragraph">
                <input type="button" onclick="word_choose('lane')" value="巷" class="button" name="lane" id="lane">
            </div>
            <div>
                <input type="button" onclick="word_choose('get')" value="弄" class="button" name="get" id="get">
                <input type="button" onclick="word_choose('number')" value="號" class="button" name="number" id="number">
                <input type="button" onclick="word_choose('floor')" value="樓" class="button" name="floor" id="floor">
                <input type="button" onclick="word_choose('room')" value="室" class="button" name="room" id="room">
            </div>
            <div>
                <input type="button" onclick="word_choose('the')" value="之" class="button" name="the" id="the">
                <input type="button" onclick="word_choose('del')" value="Del" class="button" name="del" id="del">
            </div>
            <div>
                <input type="button" onclick="word_choose('number_1')" value="1" class="button" name="number_1" id="number_1">
                <input type="button" onclick="word_choose('number_2')" value="2" class="button" name="number_2" id="number_2">
                <input type="button" onclick="word_choose('number_3')" value="3" class="button" name="number_3" id="number_3">
                <input type="button" onclick="word_choose('number_4')" value="4" class="button" name="number_4" id="number_4">
                <input type="button" onclick="word_choose('number_5')" value="5" class="button" name="number_5" id="number_5">
            </div>
            <div>
                <input type="button" onclick="word_choose('number_6')" value="6" class="button" name="number_6" id="number_6">
                <input type="button" onclick="word_choose('number_7')" value="7" class="button" name="number_7" id="number_7">
                <input type="button" onclick="word_choose('number_8')" value="8" class="button" name="number_8" id="number_8">
                <input type="button" onclick="word_choose('number_9')" value="9" class="button" name="number_9" id="number_9">
                <input type="button" onclick="word_choose('number_0')" value="0" class="button" name="number_0" id="number_0">
            </div>
        </div>
        <div style="clear: both;"></div>
        <div id="addr_div" style="padding:10px">
            <input type="text" value="" id="address" >
        </div>

    </div>

    <div id="administrative_area_select" style="display: none;">
        <div id="city_div"  style="float:left;padding:10px">
            <h3>縣市</h3>
            <select onchange="administrative_area_city_choose();" style="width:102px;" size="30" id="administrative_city">
                <option value="">請選擇</option>
                <?
                foreach($address_city as $key=>$val){
                ?>
                <option value="<?= $val->id ?>"><?= $val->name ?></option>
                <?
                }
                ?>
            </select>
        </div>
        <div id="area_div"  style="float:left;padding:10px;width:102px;">
            <h3>區域</h3>
            <select onchange="administrative_area_choose();" style="width:102px;" size="30" id="administrative_country">
                <option value="">請選擇</option>
                <?
                foreach($address_county as $key=>$val){
                ?>
                <option value="<?= $val->id ?>" ><?= $val->name ?></option>
                <?
                }
                ?>
            </select>
        </div>
        <div style="clear: both;"></div>
        <div id="addr_div" style="padding:10px">
            <input type="text" value="" id="administrative_area" >
        </div>

    </div>
    <div id="emphasis_area_select" style="display: none;"  class="form_style">
        <table class="windows_choose">
            <thead>
                <tr>
                    <th>選擇</th>
                    <th>重點區域</th>
                    <th>說明</th>

                </tr>
            </thead>
            <tbody>
                <?
                foreach($emphasis_area as $key=>$val){
                ?>
                <tr id="t_<?= $val->emphasis_area_id ?>">
                    <td><input type="radio" value="<?= $val->value ?>" name="emphasis_area_value" id="emphasis_area_value"></td>
                    <td><?= $val->value ?></td>
                    <td><?= $val->explanation ?></td>
                </tr>
                <?
                }
                ?>
            </tbody>
        </table>
    </div>
    <div id="building_name_select" style="display: none;"  class="form_style">
        <table class="windows_choose">
            <thead>
                <tr>
                    <th>選擇</th>
                    <th>名稱</th>
                    <th>說明</th>

                </tr>
            </thead>
            <tbody>
                <?
                foreach($building_name as $key=>$val){
                ?>
                <tr id="t_<?= $val->building_name_id ?>">
                    <td><input type="radio" value="<?= $val->value ?>" name="building_name_value" id="building_name_value"></td>
                    <td><?= $val->value ?></td>
                    <td><?= $val->explanation ?></td>
                </tr>
                <?
                }
                ?>
            </tbody>
        </table>
    </div>
    <div id="object_case_name_select" style="display: none;"  class="form_style">
        <table class="windows_choose">
            <thead>
                <tr>
                    <th>選擇</th>
                    <th>物件編號</th>
                    <th>案名</th>

                </tr>
            </thead>
            <tbody>
                <?
                foreach($object_case_name as $key=>$val){
                ?>
                <tr id="t_<?= $key ?>">
                    <td><input type="radio" value="<?= $val['case_name'] ?>" name="object_case_name_value" id="object_case_name_value"></td>
                    <td><?= $val['object_no'] ?></td>
                    <td><?= $val['case_name'] ?></td>
                </tr>
                <?
                }
                ?>
            </tbody>
        </table>
    </div>
</div>
</div>
<?=
isset($footer) ? $footer : '' ?>
